<template>
	<view style="position: relative;">
		<u-navbar title='我的' left-icon=" " :titleStyle="{color:'white'}" bgColor="transparent"
			:placeholder="true"></u-navbar>
		<image src="https://renovationcdn.jiachuangnet.com/mine/mineHeader.jpg"
			style="width:750rpx;height: 410rpx;position: absolute;top:0;left:0"></image>
		<view style="width:700rpx;min-height:160rpx;position: absolute;top:180rpx;left:25rpx;padding-bottom:200rpx">
			<view class="flex alignItem bewteen">
				<view class="userInfo">
					<view v-if='isLogin' class="flex">
						<image @click="showViewImg=true" v-if="userData.avatar" :src="'https://'+userData.avatar"
							mode="" style="width: 120rpx;height:120rpx;border-radius: 50% "></image>
						<image @click="showViewImg=true" v-else
							src="https://renovationcdn.jiachuangnet.com/mine/avatar.png"
							style="width: 120rpx;height:120rpx"></image>
						<view style="margin-left:10rpx;color:white">
							<view class="flex">
								<view style="font-size:32rpx;font-weight: 700;margin-right: 15rpx;">
									{{userData.nickName?userData.nickName:userData.userName}}
								</view>
								<view v-if="loginType==6&&talentState==0">
									<u-tag text="未入驻" type="warning" shape="circle" size="mini"></u-tag>
								</view>
								<view v-if="loginType==6&&talentState==1">
									<u-tag text="已认证" type="success" shape="circle" size="mini"></u-tag>
								</view>
								<view v-if="loginType==6&&talentState==2">
									<u-tag text="待审核" type="warning" shape="circle" size="mini"></u-tag>
								</view>
								<view v-if="loginType==6&&talentState==3">
									<u-tag text="已驳回" type="error" shape="circle" size="mini"></u-tag>
								</view>
								<view v-if="loginType==6&&talentState==4">
									<u-tag text="已禁用" type="error" shape="circle" size="mini"></u-tag>
								</view>
							</view>

							<view style="font-size: 28rpx;margin-top: 14rpx;">{{userData.phoneNum}}</view>
						</view>
					</view>
					<view v-else class="flex" style="align-items: center;" @click="toPath_1('login/index')">
						<image src="https://renovationcdn.jiachuangnet.com/mine/avatar.png"
							style="width: 120rpx;height:120rpx"></image>
						<view style="margin-left: 10rpx;color:white;font-size: 32rpx;font-weight:700">您好，请登录！</view>
					</view>
					<upload :isreLoad="true" ref="avatar" name='avatar' :maxCount="1"
						@uploadFile="uploadFile($event,'avatar')" v-show="false"></upload>
				</view>

				<view style="display: flex;align-items: center;">
					<view style="margin-right: 50rpx;" @click="toPath('packageA/page/notice/index')" v-if="loginType!==7">
						<image mode="aspectFill" style="display:block;width:37rpx;height: 37rpx;margin-left:10rpx"
							src="https://renovationcdn.jiachuangnet.com/mine/notice.png"></image>
						<view style="color:white;font-size: 24rpx;">消息</view>
					</view>
					<view style="margin-right: 50rpx;" @click="messageBoxShow=true" v-else>
						<image mode="aspectFill" style="display:block;width:37rpx;height: 37rpx;margin-left:10rpx"
							src="https://renovationcdn.jiachuangnet.com/mine/notice.png"></image>
						<view style="color:white;font-size: 24rpx;">消息</view>
					</view>
					<image @click="scanQRCode" src="https://renovationcdn.jiachuangnet.com/mine/scan1.png" mode=""
						style="width: 37rpx;height: 33rpx;"></image>
				</view>
			</view>
			<view class="list paddingTopBottom20" style="margin-top: 40rpx;">
				<u-grid :border="true" :col="4">
					<u-grid-item>
						<u-count-to color='#1E272E' :startVal="0" :endVal="dataObj.finishedNum"></u-count-to>
						<!-- <u-count-to v-if="baseListIndex == 3"  :color='color':startVal="0" :endVal="baseListItem.count"></u-count-to>
						<u-count-to v-if="baseListIndex == 2"  color='#f56c6c':startVal="0" :endVal="baseListItem.count"></u-count-to>
						<u-count-to v-if='baseListIndex == 0' color="#3c9cff" :startVal="0" :endVal="baseListItem.count"></u-count-to>
						<u-count-to v-if='baseListIndex == 1' color='#f9ae3d':startVal="0" :endVal="baseListItem.count"></u-count-to> -->
						<view style="color:#8A8A8A;font-size: 24rpx;" class="top20">已完结</view>
					</u-grid-item>
					<u-grid-item>
						<u-count-to color='#1E272E' :startVal="0" :endVal="dataObj.startedNum"></u-count-to>
						<view style="color:#8A8A8A;font-size: 24rpx;" class="top20">待开始</view>
					</u-grid-item>
					<u-grid-item>
						<u-count-to color='#1E272E' :startVal="0" :endVal="dataObj.overdueNum"></u-count-to>
						<view style="color:#8A8A8A;font-size: 24rpx;" class="top20">已逾期</view>
					</u-grid-item>
					<u-grid-item>
						<u-count-to color='#1E272E' :startVal="0" :endVal="dataObj.underwayNum"></u-count-to>
						<view style="color:#8A8A8A;font-size: 24rpx;" class="top20">进行中</view>
					</u-grid-item>
				</u-grid>
				<u-toast ref="uToast" />
			</view>
			<view
				style="background-color: white;border-radius:20rpx;background:white;margin-top:30rpx;padding-top:20rpx">

				<view style="display: flex;z-index:100;margin: 20rpx;" class="alignItem">
					<view class="line1"></view>
					<view :style="{'color':color,'fontWeight':'700'}">数据总览</view>
				</view>
				<view class="list flex alignItem bewteen"
					style="flex-wrap: wrap;width:calc(100% - 50rpx);padding:25rpx;background-color: transparent;">
					<view class="dataItem">
						<image src='https://renovationcdn.jiachuangnet.com/mine/weekdayDone.png' class="dataBg" />
						<view class="dataViewItem">
							<view class="dataViewItemCount">
								<u-count-to :startVal="0" :endVal="dataObj.weekFinishedNum"></u-count-to>
							</view>

							<view style="margin-top:20rpx">本周已完成</view>
						</view>
					</view>
					<view class="dataItem">
						<image src='https://renovationcdn.jiachuangnet.com/mine/weekOverdue.png' class="dataBg" />
						<view class="dataViewItem">
							<view class="dataViewItemCount">
								<u-count-to :startVal="0" :endVal="dataObj.weekOverdueNum"></u-count-to>
							</view>
							<view style="margin-top:20rpx">本周已逾期</view>
						</view>
					</view>
					<view class="dataItem">
						<image src='https://renovationcdn.jiachuangnet.com/mine/moonDone.png' class="dataBg" />
						<view class="dataViewItem">
							<view class="dataViewItemCount">
								<u-count-to :startVal="0" :endVal="dataObj.monthFinishedNum"></u-count-to>
							</view>
							<view style="margin-top:20rpx">本月已完成</view>
						</view>
					</view>
					<view class="dataItem">
						<image src='https://renovationcdn.jiachuangnet.com/mine/moonOverdue.png' class="dataBg" />
						<view class="dataViewItem">
							<view class="dataViewItemCount">
								<u-count-to :startVal="0" :endVal="dataObj.monthOverdueNum"></u-count-to>
							</view>
							<view style="margin-top:20rpx">本月已逾期</view>
						</view>

					</view>
				</view>
				<!-- <image
				src='http://skv5jh74d.hn-bkt.clouddn.com/mine/advertisement.png?e=1728293419&token=Uw65xcftwz9gmAL88CkCQDOLnHuqiD5jAvGQ7msg:Wr1s2xdW1n-nzcptYdz1Nlor2Ic='
				style="width: 710rpx;height: 203rpx;margin-top:20rpx"></image> -->
			</view>
			<view class="list" style="margin-top: 30rpx;">
				<!-- <view @click="toPath('index/index')" class="flex listItem" v-if="talentState!=4">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/liebiao.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">任务列表</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view> -->
				<view @click="toPath('afterSales/index')" class="flex listItem" v-if="talentState!=4 && loginType != 4 && loginType != 10 && loginType != 11">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/liebiao.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">售后列表</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="gotoStatistics" class="flex listItem" v-if="loginType==1||loginType==7 || loginType==0">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/msg.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">数据看板</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPathA('warehouseMonitoring')" class="flex listItem" v-if="loginType==0">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/msg.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">仓库监控</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPathB_1('urgentTask')" class="flex listItem" v-if="[7].includes(loginType) ">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/liebiao.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">临期任务</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPathWork" class="flex listItem" v-if="[7,8,9].includes(loginType) ">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/msg.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">巡店</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPath(`applyForEntry/index?isEdit=1&talentState=${talentState}`)" class="flex listItem"
					v-if="loginType===6&&isPersonMsg">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/msg.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">个人信息</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPathB_1('collect')" class="flex listItem" v-if="loginType != 4 && loginType != 2 && loginType != 11 && loginType != 10 && loginType != 5">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/shouc.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">收藏列表</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view v-if="loginType===1||loginType===3||loginType===0" @click="toPath('overdue/index')"
					class="flex listItem">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/overdueIcon.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">我的逾期</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view v-if="loginType===1||loginType===3||loginType===0" @click="toPath('checkRecord/index')"
					class="flex listItem">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/invite.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">打卡记录</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPath('/packageA/pages/invite/index')" class="flex listItem" v-if="loginType != 4 && loginType != 2 && loginType != 5 && loginType != 10 && loginType != 11">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/invite.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">邀请用户</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPath('comfirmPay/totalPayList')" class="flex listItem" v-if="loginType==4">
					<view class="flex line">
						<image src="https://qiniushelves.jiachuangnet.com/renovation/img/V8052831743142492122.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">付款记录</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
				<view @click="toPathC('updatePwd')" class="flex listItem">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/updatePwd.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">修改密码</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>
			<!-- 	<view @click="toPath('/packageA/pages/canvasCad/index','more')" class="flex listItem">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/updatePwd.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">测试CAD</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view> -->
				<view @click="toPath('/packageA/pages/driver/index','more')" class="flex listItem" v-if="loginType != 4 && loginType != 2 && loginType != 5 && loginType != 11 && loginType != 10">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/updatePwd.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">录入司机</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view> 
				<!-- <view @click="toPath('setting/index')" class="flex listItem" >
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/setting.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">账号设置</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view> -->
				<view @click="logOut" class="flex listItem">
					<view class="flex line">
						<image src="https://renovationcdn.jiachuangnet.com/mine/loginOut.png"
							style="width: 58rpx;height: 58rpx;"></image>
						<text style="margin-left: 10rpx;font-size: 28rpx">退出登陆</text>
					</view>
					<u-icon name="arrow-right" color='#9C9C9C' size="17rpx"></u-icon>
				</view>

			</view>
		</view>
		<u-popup :show="showViewImg" @close="showViewImg=false" round="10">
			<view class="btn" @click="viewImage(userData.avatar)">
				查看图片
			</view>
			<view class="btn" style="margin-bottom: 100rpx;" @click="reLoadImage">
				重新上传
			</view>
		</u-popup>
		<u-popup :show="messageBoxShow" @close="messageBoxShow=false" round="10" mode="center">
			<view class="overdueForm1">
				<view class="" style="width: 65vw;">
					<view class="messageBoxItem" @click="toPathA('textEdit')">
						发布消息
					</view>
					<view class="messageBoxItem" @click="toPathA('noticeList')">
						发布记录
					</view>
					<view class="messageBoxItem" @click="toPathB('notice')" style="border-bottom: unset;">
						我的消息
					</view>
				</view>
			</view>
		</u-popup>
		<newTabbar :index="tabbarList.length == 4 ? 3 :2" v-if="tabbarShow"
			style="position: fixed;top:0;bottom:0;z-index:10000000" :tabbarList='tabbarList'
			:time="new Date().getTime()"> </newTabbar>

	</view>
</template>
<script>
	let app = getApp();
	import newTabbar from '@/components/newTabbar/index.vue'
	export default {
		components: {
			newTabbar
		},
		data() {
			return {
				messageBoxShow: false,
				showViewImg: false,
				isPersonMsg: false,
				color: app.globalData.defaultColor,
				isLogin: uni.getStorageSync('isLogin') === 'yes' ? true : false,
				userData: {
					nickName: uni.getStorageSync('nickName') || '',
					userName: uni.getStorageSync('userName') || '',
					phoneNum: uni.getStorageSync('phoneNum') || '',
					avatar: uni.getStorageSync('avatar') || ''
				},
				tabbarList: [{
						'text': '首页',
						'path': 'settled',
						'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/indexed.png',
						'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/index.png',
						'name': '首页'
					},
					{
						'text': '我的',
						'path': 'mine',
						'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/mined.png',
						'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/mine.png',
						'name': '我的'
					}
				],
				dataObj: {
					finishedNum: 0,
					monthFinishedNum: 0,
					monthOverdueNum: 0,
					overdueNum: 0,
					startedNum: 0,
					underwayNum: 0,
					weekFinishedNum: 0,
					weekOverdueNum: 0

				},
				loginType: null,
				talentState: null,
				tabbarShow: false,

			}
		},
		onShow() {
			this.messageBoxShow = false
			this.userInfo();
			this.loginType = uni.getStorageSync('loginType')
			this.isLogin = uni.getStorageSync('isLogin') === 'yes' ? true : false,
				this.getDataSummary();
			uni.$u.http.get('/talent/isEnrolled').then(res => {
				this.talentState = res
				if (res != 0) {
					this.isPersonMsg = true
				}
				if (res == 0 && this.loginType == 6 && uni.getStorageSync('prompt') == 'yes') {
					// 提示用户申请入驻
					uni.showModal({
						title: '温馨提示',
						content: '您还未申请入驻,无法接单:)',
						confirmText: '去申请',
						cancelText: '下次再说',
						success: (e) => {
							if (e.confirm) {
								uni.navigateTo({
									url: '/pages/applyForEntry/index'
								})
							}
							if (e.cancel) {
								uni.setStorageSync('prompt', 'no')
							}
						}
					})
				}
				if (res == 4) {
					uni.$u.http.post('/user/logout').then(res => {
						uni.setStorageSync('isLogin', 'no')
						uni.setStorageSync('prompt', 'no')
						//清空保存的token
						uni.removeStorageSync('token');
						uni.removeStorageSync('userName');
						uni.removeStorageSync('userId');
						uni.removeStorageSync('phoneNum');
						uni.removeStorageSync('password');
						uni.removeStorageSync('nickName');
						uni.removeStorageSync('roleId');
						uni.removeStorageSync('avatar');
						uni.removeStorageSync('loginType');
						uni.removeStorageSync('userId')
						uni.removeStorageSync('companyName')
						uni.navigateTo({
							url: '/pages/login/index',
							success: () => {
								uni.showModal({
									title: '账号异常',
									content: '该账号被禁用,请联系管理员:)',
								})
							}
						});
					})

				}
			})
		},
		onLoad() {
			// uni.setStorageSync('isLogin', 'yes')
		},
		onHide() {

			this.tabbarList = [{
					'text': '首页',
					'path': 'settled',
					'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/indexed.png',
					'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/index.png',
					'name': '首页'
				},
				{
					'text': '我的',
					'path': 'mine',
					'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/mined.png',
					'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/mine.png',
					'name': '我的'
				}
			]

		},
		onUnload() {
			// this.tabbarList = this.$options.data(this).tabbarList;

			this.tabbarList = [{
					'text': '首页',
					'path': 'settled',
					'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/indexed.png',
					'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/index.png',
					'name': '首页'
				},
				{
					'text': '我的',
					'path': 'mine',
					'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/mined.png',
					'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/mine.png',
					'name': '我的'
				}
			]

		},
		methods: {
			toPathWork(){
				if(this.loginType==9){
					//店长-待办
					uni.navigateTo({
						url: `/packageC/pages/todo/index`
					})
				}else{
					uni.navigateTo({
						url: `/packageC/pages/workbench/index`
					})
				}
			},
			toPathB(url) {
				uni.navigateTo({
					url: `/pages/${url}/index`
				})
			},
			toPathC(url){
				console.log(url,'1')
				uni.navigateTo({
					url: `/packageC/pages/${url}/index`
				})
			},
			toPathB_1(url) {
				uni.navigateTo({
					url: `/packageB/pages/${url}/index`
				})
			},
			toPathA(url) {
				uni.navigateTo({
					url: `/packageA/pages/${url}/index`
				})
			},
			gotoStatistics() {
				if (this.loginType == 1) {
					uni.navigateTo({
						url: '/packageA/pages/statisticsCompany/index'
					})
				}
				if (this.loginType == 7 || this.loginType == 0) {
					uni.navigateTo({
						url: '/packageB/pages/statistics/index'
					})
				}
			},
			getAuthorizeCamera() {
				// 获取摄像头权限
				uni.authorize({
					scope: 'scope.camera',
					success: () => {

						this.scanQRCode()
					},
					fail() {
						// 用户拒绝授权
						uni.showToast({
							title: '您拒绝了授权',
							icon: 'none'
						});
					}
				});
			},
			scanQRCode() {
				// uni.showLoading({
				// 	title: '二维码识别中,请稍等 :)'
				// });
				uni.scanCode({
					success(res) {
						console.log(res)
						// #ifdef APP
						let path = res.result.split('?')[0]
						//微信开发者工具 在开发者工具里出现乱码需要decodeURIComponent转义,真机不需要,可以直接使用
						if (res.result.indexOf("%3D") !== -1) {
							// 调试
							uni.navigateTo({
								url: res.result
							})
						} else {
							// 真机
							let scene = res.result.split('=')[1] + '=' + res.result.split('=')[2]
							let sceneEncode = encodeURIComponent(scene)
							console.log(path + '?scene=' + sceneEncode)
							if (path[0] == '/') {
								console.log('666')
								uni.navigateTo({
									url: path + '?scene=' + sceneEncode
								})
							} else {
								console.log('777')
								uni.navigateTo({
									url: '/' + path + '?scene=' + sceneEncode
								})
							}

						}
						// #endif

						// #ifdef MP-WEIXIN
						let path = res.path.split('?')[0]
						//微信开发者工具 在开发者工具里出现乱码需要decodeURIComponent转义,真机不需要,可以直接使用
						if (res.path.indexOf("%3D") !== -1) {
							// 调试
							uni.navigateTo({
								url: '/' + res.path
							})
						} else {
							// 真机
							let scene = res.path.split('=')[1] + '=' + res.path.split('=')[2]
							let sceneEncode = encodeURIComponent(scene)
							console.log('/' + path + '?scene=' + sceneEncode)
							uni.navigateTo({
								url: '/' + path + '?scene=' + sceneEncode
							})
						}

						// #endif



					},
					fail() {
						// 调用相机失败
						uni.hideLoading();
						uni.showToast({
							title: '调用相机失败',
							icon: 'none'
						});
					}
				});
			},
			uploadFile(e) {
				uni.$u.http.post('/user/updateAccountSetting', {
					userId: uni.getStorageSync('userId'),
					avatar: e.files[0],
				}).then(res => {
					if (res) {
						uni.showToast({
							title: '头像修改成功',
							duration: 2000
						})
						this.userInfo();
						this.showViewImg = false
					}
				})
			},
			reLoadImage() {
				// 上传头像
				this.$refs['avatar'].clickUpload()
			},
			viewImage(url) {
				uni.previewImage({
					current: 0,
					urls: ['https://' + url],
					longPressActions: {
						itemList: ['保存图片'],
						success: data => {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
							uni.closePreviewImage()
							/* 保存图片到系统相册 */
							if (data.tapIndex == 0) {
								uni.getImageInfo({
									src: 'https://' + url,
									success: function(res) {
										console.log(res)
										uni.saveImageToPhotosAlbum({ //保存图片到系统相册。
											filePath: res.path, //图片文件路径
											success: function() {
												uni.showToast({
													title: '图片保存成功',
													icon: 'none',
												});
											},
											fail: function(e) {
												console.log(e);
												uni.showToast({
													title: '图片保存失败',
													icon: 'none',
												});
											},
										});
									},
									fail: function(e) {
										console.log(e);
										uni.closePreviewImage()
										uni.showToast({
											title: '图片保存失败',
											icon: 'none',
										});
									},
								})
							}
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			getDataSummary() {
				uni.$u.http.get('/assign/getDataSummary').then(res => {
					console.log(res, '数据总栏')
					if (res) {
						this.dataObj.finishedNum = res.finishedNum
						this.dataObj.monthFinishedNum = res.monthFinishedNum
						this.dataObj.monthOverdueNum = res.monthOverdueNum
						this.dataObj.overdueNum = res.overdueNum
						this.dataObj.startedNum = res.startedNum
						this.dataObj.underwayNum = res.underwayNum
						this.dataObj.weekFinishedNum = res.weekFinishedNum
						this.dataObj.weekOverdueNum = res.weekOverdueNum
					}
				})
			},
			logOut() {
				if (!this.isLogin) {
					return uni.$u.toast('请登录:)');
				}
				uni.$u.http.post('/user/logout').then(res => {
					uni.setStorageSync('isLogin', 'no')
					uni.setStorageSync('prompt', 'no')
					//清空保存的token
					uni.removeStorageSync('token');
					uni.removeStorageSync('userName');
					uni.removeStorageSync('userId');
					uni.removeStorageSync('userName');
					uni.removeStorageSync('phoneNum');
					uni.removeStorageSync('password');
					uni.removeStorageSync('nickName');
					uni.removeStorageSync('roleId');
					uni.removeStorageSync('avatar');
					uni.removeStorageSync('loginType');
					uni.removeStorageSync('userId')
					uni.removeStorageSync('companyName')
					uni.navigateTo({
						url: '/pages/login/index'
					})
				})
			},
			toPath(url,type) {
				if(url == '/packageA/pages/driver/index'){
					uni.navigateTo({
						url: "/pages/" + url
					})	
				}
				if (!this.isLogin) {
					return uni.$u.toast('请登录:)');
				}
				if(type == 'more'){
					 uni.navigateTo({
					 	url: url
					 })
				}else{
					if(url == '/packageA/pages/invite/index'){
						uni.navigateTo({
							url: "/packageA/pages/invite/index" 
						})
					}else{
						uni.navigateTo({
							url: "/pages/" + url
						})	
					}
				
				}
				
			},
			toPath_1(url) {
				uni.navigateTo({
					url: "/pages/" + url
				})
			},
			userInfo() {
				uni.$u.http.get('/user/userInfo').then(res => {
					console.log(res, '获取用户信息')
					if (res) {
						this.isLogin = true;
						this.userData = res;
						uni.setStorageSync('avatar', res.avatar)
						uni.setStorageSync('nickName', res.nickName)
						uni.setStorageSync('roleId', res.roleId)
						uni.setStorageSync('userId', res.userId)
						uni.setStorageSync('loginType', res.loginType)
						uni.setStorageSync('phoneNum', res.phoneNum)
						uni.setStorageSync('userId', res.userId)
						this.loginType = res.loginType;
						const worker = {
							'text': '人才库',
							'path': 'talentPool',
							'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/worked.png',
							'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/worker.png',
							'name': '人才库'
						}
						const shop = {
							'text': '店铺管理',
							'path': 'manageStore',
							'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/jiankonged.png',
							'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/jiankong.png',
							'name': '店铺管理'
						}
						const jianliStoreManage = {
							'text': '店铺管理',
							'path': 'jianliStoreManage',
							'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/jiankonged.png',
							'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/jiankong.png',
							'name': '店铺管理'
						}
						const shopmanager = {
							'text': '店铺管理',
							'path': 'storeManage',
							'activeIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/jiankonged.png',
							'inactiveIcon': 'https://renovationcdn.jiachuangnet.com/tabbarIcon/jiankong.png',
							'name': '店铺管理'
						}
						uni.getStorage({
							key: 'loginType',
							success: (res) => {
								const loginType = res.data;
								if (loginType === 0 || loginType === 2 || loginType === 7||loginType === 10) {
									//  监理 
									if (loginType === 2) {
										this.tabbarList.splice(1, 0, jianliStoreManage);
									} else {
										// 超管  品排方
										this.tabbarList.splice(1, 0, shop);
									}
									this.tabbarList.splice(2, 0, worker);
								}
								if (loginType === 1) {
									// 装修公司管理员
									this.tabbarList.splice(1, 0, worker);
								}
								if (loginType === 4) {
									//  加盟商
									this.tabbarList.splice(1, 0, shopmanager);
								}
								if (loginType === 3) {
									// 4项目经理
									this.tabbarList.splice(1, 0, worker);
								}
								this.tabbarShow = true;
							}
						})
					} else {
						this.isLogin = false;
					}
				}).catch(err => {

				})
			},

		}
	}
</script>
<style lang="scss" scoped>
	.messageBoxItem {
		line-height: 100rpx;
		text-align: center;
		border-bottom: 2rpx solid #ccc;
	}

	.btn {
		line-height: 100rpx;
		text-align: center;
		border-bottom: 1px solid #E5E5E5;
		font-weight: 500;
		font-size: 26rpx;
		color: #8A8A8A;
	}

	.flex {
		display: flex;
	}

	.list {
		width: calc(100%);
		background-color: white;
		border-radius: 16rpx;
	}

	.line {
		align-items: center;
	}

	.listItem {
		width: calc(100% - 40rpx);
		padding: 30rpx 20rpx;
	}

	.listItem {
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #E5E5E5;
		font-size: 30rpx;
		color: #2d2d2d;
	}

	.listItem:nth-last-child(1) {
		border: none;
	}

	.dataItem {
		width: 310rpx;
		height: 163rpx;
		position: relative;

	}

	.dataViewItem {
		position: absolute;
		top: 50%;
		left: 30rpx;
		transform: translate(0, -50%);
		z-index: 100;
		font-size: 24rpx;
		color: #8A8A8A;
	}

	.dataItem:nth-child(1),
	.dataItem:nth-child(3) {
		margin-right: 12rpx;
	}

	.dataItem:nth-child(4),
	.dataItem:nth-child(3) {
		margin-top: 30rpx;
	}

	.dataViewItemCount {
		display: flex;
		justify-content: center;
	}

	.dataBg {
		position: absolute;
		top: 0;
		left: 0;
		z-index: 1;
		width: 100%;
		height: 100%;

	}

	.line1 {
		width: 8rpx;
		height: 26rpx;
		border-radius: 4rpx;
		margin-right: 10rpx;
		background-color: #13989A;
	}
</style>
<style>
	page {
		background-color: #f8f8f8;
	}
</style>